//
//  AddTimeCell.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/8/1.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit
protocol AddTimeDelegate:class {
    
    /// 添加时间
    func addTime()
}
class AddTimeCell: BaseTableViewCell {
    weak var delegate:AddTimeDelegate?
    override func setUpUI() {
        self.contentView.themeBackground = ThemeManager.ThemeColorKeys.background3
        
        let view = UIView()
        self.contentView.addSubview(view)
        view.themeBackground = ThemeManager.ThemeColorKeys.background
        view.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(16)
            make.right.equalToSuperview().offset(-16)
            make.top.bottom.equalToSuperview()
        }
        
        let addTimeBtn = UIButton()
        addTimeBtn.setTitle("+ \(kText("添加时间"))", for: UIControlState.normal)
        addTimeBtn.addTarget(self, action: #selector(addTimeAction), for: UIControlEvents.touchUpInside)
        addTimeBtn.setTitleColor(UIColor(hexStr:"#9b9b9b"), for: UIControlState.normal)
        addTimeBtn.titleLabel?.font = UIFont.systemFont(ofSize: 12)
        view.addSubview(addTimeBtn)
        addTimeBtn.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.right.equalToSuperview()
            make.top.bottom.equalToSuperview()
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    // MARK addTimeAction
    @objc func addTimeAction() -> Void {
//        self.goToTime(changeTimeBool: false, index: 0)
        if delegate != nil {
            self.delegate?.addTime()
        }
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
